package com.yumeng.ui.controller;

import com.yumeng.common.auth.BaseAuthHelper;
import com.yumeng.common.utils.PathUtils;
import com.yumeng.config.properties.YumengAuthProperties;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *
 * @author wxd
 * @date 2025/11/13 13:40
 */
@Controller
@RequestMapping("/ym/page/test")
public class YmTestTemplatesController {

    private final YumengAuthProperties yumengAuthProperties;

    @Autowired
    public YmTestTemplatesController(YumengAuthProperties yumengAuthProperties) {
        this.yumengAuthProperties = yumengAuthProperties;
    }

    /**
     * 测试页
     *
     * @return
     */
    @GetMapping("/testPage.vw")
    public String testPage(Model model, HttpServletRequest request){
        model.addAttribute("remoteUser", BaseAuthHelper.getCurrAuthInfo().getAuthKey());//request.getRemoteUser()
        model.addAttribute("logoutAction", PathUtils.removeUrlPrefix(yumengAuthProperties.getBasic().getLogoutAction()));
        model.addAttribute("loginPage", PathUtils.removeUrlPrefix(yumengAuthProperties.getBasic().getLoginUrl()));
        return "test/test_page";
    }

}
